<template>
	<view class="container">		
		<view class="u-flex u-row-center u-m-50" v-if="list.length == 0" style="flex-direction: column;">
			<image style="width:300rpx;height:300rpx;" mode="widthFix" src="../../../static/img/no.png"></image>
			<text style="color:#ccc">暂无数据</text>
		</view>
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="left">
					<view class="dot"></view>
				</view>
				<view class="center">
					<view class="title">{{item.name}}</view>
					<view class="time">{{item.createTime}}</view>
				</view>
				<view class="right">
					<view class="amount">{{item.money}}元</view>
				</view>
			</view>
		</view>
		<u-loadmore class="u-m-t-40" v-if="list.length > 5" :status="loadStatus" bgColor="#f0f0f0"></u-loadmore>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loadStatus: 'loadmore',
				list: [],
				form: {
					isTk:true,
					pageNum: 1,
					pageSize: 10,
					status: 1
				}
			}
		},
		onLoad() {
			this.getList();
		},
		onPullDownRefresh: function() {
			this.form.pageNum = 1;
			this.getList();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom:function(e){
			// 此tab为空数据
			this.form.pageNum += 1;
			this.loadStatus= "loading";
			this.getList(this.form.pageNum);
			setTimeout(() => {
				this.loadStatus="loadmore";
			}, 1000);
		},
		methods: {
			async getList() {
				let data = await this.$apis.findIsTkAll(this.form);
				if(data.code === 200){
					if (data.data.last) {
						this.loadStatus = "nomore";
					}
					this.list = data.data.content;
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background-color: #f0f0f0;
	}

	.container {
		padding: 0 30upx;

		.list {
			width: 100%;

			.item {
				width: 690upx;
				height: 130upx;
				background-color: #fff;
				border-radius: 20upx;
				margin-bottom: 20upx;
				display: flex;
				padding: 0 24upx;
				justify-content: space-between;

				.right {
					display: flex;
					align-items: center;

					.amount {
						width: 100%;
						color: #AB62FF;
						font-size: 34upx;
						text-align: right;
						margin-right: 15upx;
					}
				}

				.center {
					margin-left: 24upx;
					display: flex;
					flex-direction: column;
					padding: 26upx 0;
					justify-content: space-between;
					flex: 1;

					.title {
						color: #0E1E36;
						font-size: 32upx;
					}

					.time {
						color: #888E9A;
						font-size: 26upx;
					}
				}

				.left {
					display: flex;
					align-items: center;

					.dot {
						width: 14upx;
						height: 14upx;
						border-radius: 50%;
						background: linear-gradient(0deg, #30CE94, #72E07C);
					}
				}
			}
		}
	}
</style>
